"""

烤地瓜案例
1. 被烤的时间和对应的地⽠状态：
0-3分钟：⽣的
3-5分钟：半⽣不熟
5-8分钟：熟的
超过8分钟：烤糊了
2. 添加的调料：
⽤户可以按⾃⼰的意愿添加调料
"""


class SweetPotato():
    def __init__(self):
        # 被烤时间
        self.time = 0
        # 地⽠的状态
        self.status = '生的'
        # 调料列表
        self.flavour = []
        print('初始化成功')
        pass

    def add_flavour(self, flavour):
        self.flavour.append(flavour)
        print(f'添加了原料:{flavour}')
        pass

    def bake(self, time):
        """
        烤地瓜方法
        :param time: 
        :return: 
        """
        self.time += time
        time=self.time
        if 0 <= time < 3:
            self.status = '生的'
            pass
        elif 3 <= time < 5:
            self.status = '半生不熟的'
            pass
        elif 5 <= time < 8:
            self.status = '熟的'
            pass
        elif 8 <= time:
            self.status = '烤糊了'
            pass
        else:
            print(f'输入的时间错误:{time}')
            return
            pass
        self.time = time
        print(f'烤的时间: {time},烤的状态:{self.status}')

        pass

    def __str__(self):
        return f'这个地瓜烤了:{self.time}分钟,状态是{self.status},香料列表是{self.flavour}'
        pass

    pass


potato = SweetPotato()
print(potato)
potato.bake(3)
potato.add_flavour('香料1')
print(potato)
